package cn.jji8.mysqlUse.mySqlSimpleUse.error;

import java.io.PrintStream;
import java.io.PrintWriter;
import java.sql.SQLException;

/**
 * 表格的异常父类
 * */
public class TableException extends RuntimeException{
    SQLException sqlException;
    public TableException(String message, SQLException sqlException) {
        super(message);
        this.sqlException = sqlException;
    }
    /**
     * 获取sql异常
     * */
    public SQLException getSQLException(){
        return sqlException;
    }
    @Override
    public String getMessage() {
        return sqlException.getMessage()+"\n"+super.getMessage();
    }
    @Override
    public String toString() {
        return sqlException.toString()+"\n"+super.toString();
    }
    @Override
    public void printStackTrace() {
        super.printStackTrace();
        sqlException.printStackTrace();
    }
    @Override
    public void printStackTrace(PrintStream s) {
        super.printStackTrace(s);
        sqlException.printStackTrace(s);
    }
    @Override
    public void printStackTrace(PrintWriter s) {
        super.printStackTrace(s);
        sqlException.printStackTrace(s);
    }
}
